<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>手动预处理</title>
<%@ include file="/pages/common/header.jsp" %>

<%-- 
	<link href="<%=request.getContextPath() %>/css/base.css" rel="stylesheet" type="text/css" /> 
	<!-- 圆角文本框 -->
	<link href="<%=request.getContextPath() %>/css/htc/htc.css" rel="stylesheet" type="text/css" /> 
 	<link rev="stylesheet" media="all" href="<%=request.getContextPath() %>/css/form_style.css" type="text/css" rel="stylesheet">
--%>
 <script type="text/javascript" src="<%=request.getContextPath() %>/js/datePicker/WdatePicker.js"></script>
 <script type="text/javascript" src="<%=request.getContextPath() %>/js/ligerUI/js/plugins/ligerCheckBoxList.js"></script>
<style type="text/css">
	.navbar{line-height:33px;height:33px;background:url('${pageContext.request.contextPath}/images/background/navbar.gif') repeat-x; width:100%; position:relative; margin-top:8px; margin-bottom:8px;}
		.navbar-l,.navbar-r{ width:2px;height:33px;background:url('${pageContext.request.contextPath}/images/background/navbar.gif') no-repeat; position:absolute; }
		.navbar-l{ left:0px; background-position:0px -33px;}
		.navbar-r{ right:0px;background-position:0px -66px;}
		.navbar-icon{ position:absolute; left:7px; top:6px;}
		.navbar img{ width:20px; height:20px;}
		.navbar-inner{ margin-left:30px;}
		.navbar a{ color:#3186C8;}
</style>
<script type="text/javascript">
$(function(){


       var  data = [
		             { name: '00'+"&nbsp;&nbsp;&nbsp;&nbsp;", id: '00' },
		             { name: '01'+"&nbsp;&nbsp;&nbsp;&nbsp;", id: '01' },
		             { name: '02'+"&nbsp;&nbsp;&nbsp;&nbsp;", id: '02' },
		             { name: '03'+"&nbsp;&nbsp;&nbsp;&nbsp;", id: '03' },
		             { name: '04'+"&nbsp;&nbsp;&nbsp;&nbsp;", id: '04' },
		             { name: '05'+"&nbsp;&nbsp;&nbsp;&nbsp;", id: '05' },
		             { name: '06', id: '06' },
		             { name: '07', id: '07' },
		             { name: '08', id: '08' }, 	
		             { name: '09', id: '09' },
		             { name: '10', id: '10' },
		             { name: '11', id: '11' },
		             { name: '12', id: '12' },
		             { name: '13', id: '13'},
		             { name: '14', id: '14' },
		             { name: '15', id: '15'},
		             { name: '16', id: '16'},
		             { name: '17', id: '17' },
		             { name: '18', id: '18' },
		             { name: '19', id: '19' },
		             { name: '20', id: '20' },
		             { name: '21', id: '21' },
		             { name: '22', id: '22' },
		             { name: '23', id: '23'}
         		];
       $("#times").ligerCheckBoxList({
           data: data,
           rowSize : 6,
           textField: 'name' 
       });
    
	 
/* 	$("#times").bind('change',function(){
		var times =$("#times").val();
		var list= new Array;
		list=times.split(";");
		if(list.length>2){
			alert("只能选择开始时间和结束时时间两个时间段");
			//var startAndend = list[0]+";"+list[1];
			//$("#times").val(startAndend);
			manager.selectValue(list[0]+";"+list[1]);
		}
	}); */
	
	$("#btn1").bind('click',function(){
		var start = $('#start').val();
		var method =$('#method').val();
		var time = liger.get("times").getValue();
		var toDay =new Date();
		var year =toDay.getFullYear();
		var month =toDay.getMonth()+1;
		if(month<10){
			month="0"+month;
		}
		var day=toDay.getDate();
		if(day<10){
			day="0"+day;
		}
		/* var hours =toDay.getHours();
		if(hours<10){
			hours ="0"+hours;
		} */
		var todayStr = ""+year+month+day;
		if(time==""||time=="undefined"){
			alert("请选 择时间 ");
		}else
		if(start == "" || start== "undefined"){
			alert("请选择开始时间");
		}else if(method == "" || method =="undefined"){
			alert("请选择预处理类型");
		}else{
			start=start.replace(/-/g,"").replace(/ /g,"");
			if(start>todayStr){
				alert("开始日期不能大于当前日期");
			}else{
				$("#wait").show();
				$("#btn1").attr("disabled","true");
				var url ="<%=request.getContextPath() %>"+"/preprocess-ManualPreProcess-process.action";
				var data ={"start":start,"time":time,"method":method};
				 $.ajax({
						url:url,
						data:data,
						type : "POST",
						cache : false, 
						async : true,
					  //  dataType:'html',
					    beforeSend:function(){
					    },
					    success:function(data){
					    	alert("预处理成功！");
					    	$("#btn1").removeAttr("disabled");
					    	$("#wait").hide();
					    },
					    error:function(){
					    	alert("预处理失败！，请联系管理员！");
					    	$("#btn1").removeAttr("disabled");
					    	$("#wait").hide();
					    	},
					    	
					    complete:function(){ 
					    	$("#btn1").removeAttr("disabled");
					    	$("#wait").hide();
					    }
					});
			}
			

		}
	});
	var myDate=new Date();
	var year =myDate.getFullYear();
	var month =myDate.getMonth()+1;
	if(month<10){
		month="0"+month;
	}
	var day=myDate.getDate();
	if(day<10){
		day="0"+day;
	}
	var today=year+"-"+month+"-"+day;
	$("#start").val(today);
	
});
</script>
</head>
<body>
		
<div class="searchtitle" style="width :1100px;">
	<div class="navbar"><div class="navbar-l"></div><div class="navbar-r"></div>
	        <div class="navbar-inner"> 
	        <b>手动预处理</b> 
	        </div>
	 </div>
	<table cellSpacing=0 cellPadding=0  border=0 class="form2column">
		<tr>
			<td class="label"> 开始日期：</td>
			<td class="" style="width:250px;">
				<input name="start" type="text"	id="start" style="width: 180px"    
							onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly"/>
			</td>
			<td class=""></td>
			<td class=""></td>
		</tr>
		<tr>
			<td class="label">选择时间：</td>
			<td colspan="3" class=""> <div id="times"></div>
			</td>
		</tr>
		<tr>
			<td class="label">处理类型：</td>
			<td class="">
				<select name="method" id="method">
				<option value="">--请选择--</option>
				<option value="top5">官网和渠道差价的前五名</option>
				<option value="plus">每天官网和渠道航班的差价统计</option>
				<option value="last">实时价格处理</option>
				<option value="history">统计历史最低价</option>
				<option value="historyDouble">统计往返历史最低价</option>
				<option value="generate">生成航班信息</option>
				<option value="monitor">运价监控</option>
				<option value="cabin">舱位预警</option>
				<option value="ratio">价差预警</option>
				<option value="auction">竞价预警</option>
				<option value="lastDouble">实时往返价格处理</option>
				<option value="csairReport">南航国际报表</option>
				<option value="csairDomestic">南航国内报表</option>
				<option value="csairTaobao">南航淘宝价差</option>
				<option value="airSpread">深航报表</option>
				<option value="airChinaDomestic">国航国内OTA</option>
				<option value="airChinaInternational">国航国际OTA</option>
				<option value="airChinaTaobao">国航淘宝旗舰代理价差</option>
				<option value="metadata">元数据生成</option>
				<option value="metadataForAirs">航信元数据</option>
				<option value="metadataAll">当天元数据生成</option>
				<option value="metadataDouble">往返元数据生成</option>
				<option value="metadataAllDouble">当天往返元数据生成</option>
				<option value="lineDay">航线最低价</option>
				<option value="pereMoreData">汇率抓取入库</option>
				<option value="airLineCount">航线抓取情况统计</option>
				</select>
			</td>
			<td class=""></td>
			<td class=""></td>
		</tr>
	
		
		<tr>
			 <td colspan="4"  style="text-align:center;height:35px;" >
	           <input type="button" value="预处理" id="btn1" class="btn-normal"/>
	         </td>
		</tr>
	</table>
	<div  id="wait" style="display:none; text-align:center;" >
		<span ><font color="red"> 正在预处理中，请耐心等候...</font></span>
	</div>
	<div>
		说明：官网和渠道差价的前五名 &nbsp;&nbsp;&nbsp;&nbsp; 统计从统计日期开始到未来30的某航线下的所有航班官网与渠道价差，用于渠道首页报表<br>
			    每天官网和渠道航班的差价统计  &nbsp;&nbsp; 统计从统计日期开始到未来30的某航线下的所有航班官网与渠道价差大于3%与6% 的代理商数量，用于渠道首页报表<br>
			    实时价格处理  &nbsp;&nbsp;&nbsp;&nbsp;	 将单程的实时数据处理到mqsql数据库<br>
			    统计历史最低价&nbsp;&nbsp;保存当天抓的单程的航班最低价到Hbase表LP_FLIGHT_HISTORY 中<br>
			    统计往返历史最低价   &nbsp;&nbsp;保存当天抓的往返的航班最低价到Hbase表LP_FLIGHT_HISTORY_DOUBLE 中<br>
			    生成航班信息&nbsp;&nbsp;&nbsp;&nbsp;将当天抓到的航班信息入库<br>
			    实时往返价格处理  &nbsp;&nbsp;将往返的实时数据处理到mqsql数据库<br>  
			    元数据生成 &nbsp;&nbsp; 将上一小时抓到的数据解析为json格式上传到ftp服务器中<br>
			    当天元数据生成&nbsp;&nbsp;将一天的数据保打包上传到ftp服务器中<br>
			    航线最低价 &nbsp;&nbsp;保存当天航线的最低价到mysql表中，用于收益首页，<br>
			   汇率抓取入库&nbsp;&nbsp; 实时抓取汇率，并保存到mysql表中<br> 
			                    
	</div>
</div>
</body>
</html>